package com.itheima.controller;

import com.itheima.pojo.Enterprise;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

@RestController
@RequestMapping("/books")
public class BookController {

    @Value("${lesson}")
    private String lessonName;

    @Value("${server.port}")
    private int port;

    @Value("${enterprise.subject[1]}")
    private String subject_01;

    @Autowired
    private Enterprise enterprise;

    @GetMapping("/{id}")
    public String getById(@PathVariable Integer id){
        System.out.println("id=>"+id);

        System.out.println(lessonName);
        System.out.println(port);
        System.out.println(subject_01);

        System.out.println(enterprise);

        return "hello springboot!";

    }

}
